<?php

namespace app\common\model;

//use think\Model;

class PayInfoModel extends BaseModel{

	protected $table = 'tp_pay_info';

	/*
	获取支付信息
	 */
	public function getPayInfo($uid){
		$data = $this->where('uid',$uid)->find();
		return $data;
	}

	/*
	设置支付信息
	 */
	public function setPayInfo($uid,$data){
		$info = $this->getPayInfo($uid);
		if($info){
			$data['change_date'] = $this->getTime();
			$res = $this->where('uid',$uid)->update($data);
		} else {
			$data['uid'] = $uid;
			$data['date'] = $this->getTime();
			$res = $this->insert($data);
		}
		return $res;
	}
}